<meta charset="UTF-8">

<!-- 增删改查 -->
<div id="toolbar" class="btn-group">
	<button type="button" class="btn btn-default" onclick="classTable.btn_add()">
		<span class="glyphicon glyphicon-plus"></span>新增
	</button>
	<button type="button" class="btn btn-default" onclick="classTable.btn_edit()">
		<span class="glyphicon glyphicon-pencil"></span>修改
	</button>
	<button type="button" class="btn btn-default" onclick="classTable.btn_delete()">
		<span class="glyphicon glyphicon-remove"></span>删除
	</button>
</div>

<table id="book">
	<thead>
		<tr>
			<th data-checkbox="true"></th>
			<th data-field="id" data-valign="middle" data-order= 'asc' data-sortable= 'true'  data-align="center" >id</th>
			<th data-field="bookName" data-valign="middle" data-align="center" >图书名称</th>
			<th data-field="bookCode" data-valign="middle" data-align="center" >图书编码</th>
			<th data-field="quantity" data-valign="middle" data-align="center" >图书数量</th>
			<th data-field="press" data-valign="middle" data-align="center" >出版社</th>
			<th data-field="author" data-valign="middle" data-align="center" >作者</th>
			<th data-field="intro" data-valign="middle" data-align="center" >简介</th>
			<th data-field="booktype" data-formatter="Booktype" data-valign="middle" data-align="center" >图书类型</th>
		</tr>
	</thead>
</table>

<script>
	var option = {
		url: 'book/page1',
		urls: 'book',
		addurl: 'edit'
	}
	var table = $("#book");
	var classTable = new bootstrapTable(option, table);
	classTable.init();
	function Booktype(value,row,index){
		  return value?value.type:'';
	}
</script>
